import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-05-24
 * Time:15:15
 */
public class TestDemo1 {
    public static void main(String[] args) {
        ArrayList<String> arrayList=new ArrayList<String>();
        arrayList.add("123");
        arrayList.add("456");
        arrayList.add("789");
        System.out.println(arrayList);
        ListIterator<String> iterator= arrayList.listIterator();
        while(iterator.hasNext()){
            //String str=iterator.next();
            if(iterator.next().equals("456")){
                iterator.add("hehe");
            }
        }
        System.out.println(arrayList);

    }
}
